Querying MIDI Devices

Before playing or recording MIDI data, you must determine the capabilities of the MIDI hardware present in the system. MIDI capability can vary from one multimedia computer to the next; applications should not make assumptions about the hardware present in a given system.

Windows provides the following functions to determine how many MIDI devices are available for input or output in a given system:

midiInGetNumDevsEDN_AB

Retrieves the number of MIDI input devices present in the system.

midiOutGetNumDevs18YY8W6

Retrieves the number of MIDI output devices present in the system.

 

Like other audio devices, MIDI devices are identified by a device identifier, which is determined implicitly from the number of devices present in a given system. Device identifiers range from zero to the number of devices present, minus one. For example, if there are two MIDI output devices in a system, valid device identifiers are 0 and 1.

After you determine how many MIDI input or output devices are present in a system, you can inquire about the capabilities of each device. Windows provides the following functions to determine the capabilities of audio devices:

midiInGetDevCaps4A9FZM0

Retrieves the capabilities of a given MIDI input device and places this information in the MIDIINCAPS2ZOW.S5 structure.

midiOutGetDevCaps11B4XWO

Retrieves the capabilities of a given MIDI output device and places this information in the MIDIOUTCAPS425._HG structure.

 

Each of these functions has a parameter specifying the address of a structure that the function fills with information about the capabilities of a specified device.